1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import * as React from "react"
import type { Metadata } from "next"
import { unstable_noStore as noStore } from "next/cache"
import { getServerSession } from "next-auth"
import { Shell } from "@/components/shell"
import { NoticeClient } from "@/components/notice/notice-client"
import { InformationButton } from "@/components/information/information-button"
import { getNoticeLists } from "@/lib/notice/service"
import { authOptions } from "@/app/api/auth/[...nextauth]/route"
export const metadata: Metadata = {
title: "공지사항 관리",
description: "페이지별 공지사항을 관리합니다.",
}
export default async function NoticePage() {
noStore()
// 세션에서 사용자 ID 가져오기
const session = await getServerSession(authOptions)
const currentUserId = session?.user?.id ? parseInt(session.user.id) : undefined
// 간단한 초기 데이터 로딩
const initialData = await getNoticeLists({
page: 1,
perPage: 50,
search: "",
sort: [{ id: "createdAt", desc: true }],
flags: [],
filters: [],
joinOperator: "and",
pagePath: "",
title: "",
content: "",
authorId: currentUserId || null,
isActive: true,
from: "",
to: "",
})
return (
<Shell className="gap-2">
<div className="flex items-center justify-between space-y-2">
<div className="flex items-center justify-between space-y-2">
<div>
<div className="flex items-center gap-2">
<h2 className="text-2xl font-bold tracking-tight">
공지사항 관리
</h2>
<InformationButton pagePath="evcp/notice" />
</div>
</div>
</div>
</div>
<NoticeClient initialData={initialData?.data || []} currentUserId={currentUserId} />
</Shell>
)
}
|